var baseURL = getBaseURL();
function getBaseURL(){ 
	var path = window.document.location.pathname;
	var projectName = path.substring(0,path.substr(1).indexOf('/')+2);
	return projectName;
}

function getParam(key){
	var tmpArr,string,value;
	var URL = document.location.toString();
	if (URL.lastIndexOf("?") != -1) {
		string = URL.substring(URL.lastIndexOf("?") + 1, URL.length);
	    if(string.indexOf("#") > 0 ){
	    	string = string.substring(0, string.lastIndexOf("#"));
	    }
	    tmpArr = string.split("&");//分离参数
	    for (i = 0; i <= tmpArr.length; i++) {
	        try { 
	        	var arr = tmpArr[i].split("=");
	        	var key_ = $.trim(arr[0]);
	        	if($.trim(key_)==key){
	        		value = $.trim(arr[1]);
	        		break;
	        	}
	        } catch (e) {
	            var re = new RegExp("(.*)=(.*)", "ig");
	            re.exec(tmpArr[i]);
	            try { eval(RegExp.$1 + "=" + "\"" + RegExp.$2 + "\""); }
	            catch (e) {}
	        }
	    }
	}
	return value;
}


function guid() {
    return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
        return v.toString(32);
    });
}

$(function(){
	window.onload = function() {
		var $li = $('#tab li');
		var $ul = $('#content .tabUI');
					
		$li.click(function(){
			var $this = $(this);
			var $t = $this.index();
			$li.removeClass();
			$this.addClass('current');
			$ul.css('display','none');
			$ul.eq($t).css('display','block');
		})
	}
	
	$("#all").click(function(){   
	    if(this.checked){ 
	        $(".selBOX :checkbox").prop("checked", true);  
	    }else{   
	    	$(".selBOX :checkbox").prop("checked", false);
	    }   
	});
});